package leedcode_path.Link;

public class 翻转链表 {

    public ListNode reverseList(ListNode head) {
            if(head==null){
                return head;
            }
            ListNode cur=head;
            ListNode pre=null;
            while (cur!=null){
                ListNode tem=cur.next;
                cur.next=pre;
                pre=cur;
                cur=tem;
            }
            return pre;

    }
}
